
peanut.RoleManager = Ext.extend(peanut.CrudPanel, {
    id: "UserInfoPanelId",
    title: "角色管理",
    //width: 400,
	//height: 300,
    //这个是数据源url
    baseUrl: __base+"/admin/role/all",
    ID: "id",
    storeMapping: ["id","name","enabled"],
	
    createForm: function(){
        var formPanel = new Ext.form.FormPanel({
			plain:true,
			layout:"form",
			defaultType:"textfield",
			labelWidth:75,
            baseCls:"x-plain",
			//锚点布局-
			defaults:{anchor:"100%",msgTarget:"side"},
			buttonAlign:"center",
			bodyStyle:"padding:0 0 0 0",
			items:[{
			        name:"DepartmentID",
					fieldLabel:"<font color=red>系部</font>",
					readOnly:false
			},{        
			        name:"SpecialtyID",
					xtype:"combo",
					fieldLabel:"专业",
					//传入后台真实值value field /value
					hiddenName:"SpecialtyID",
					readOnly:true,
					mode:"local",
					displayField:"show",
					valueField:"value",
					triggerAction:"all",
					value:"Java开发",
					store:new Ext.data.SimpleStore({
						fields:["show","value"],
						data:[["Java开发","Java开发"],[".NET开发",".NET开发"]]
					})
			},{
			        name:"CourseID",
					fieldLabel:"<font color=red>课程编号</font>"
			},{
			        name:"CourseName",
					fieldLabel:"<font color=red>课程名称</font>",
					allowBlank:false,
                    blankText:"课程名称不允许为空",
                    regex:/^[\s\S]{1,10}$/,
                    regexText:"课程名称请不要超过10个字符"
			},{
			        name:"CourseType",
					fieldLabel:"类型"
					
			},{   
			        name:"Remark",
					fieldLabel:"备注"
			},{
			        name: "id",
			       xtype: "hidden"
			}]
	    });
			
        return formPanel;
    },
    createWin: function(status){
        return this.initWin(380, 300, status);
    },

 
    constructor: function(config){
        
        this.sm = new Ext.grid.CheckboxSelectionModel();
        
        this.cm = new Ext.grid.ColumnModel([
            new Ext.grid.RowNumberer(),//获得行号
		    this.sm,
		    {
		        header:"系部",
		        dataIndex:"id",
		        align:'center',
		        tooltip:"系部",
		        style:'font-weight:bold;',
		        //可以进行排序
                sortable:true
	        },{
		        header:"专业",
		        tooltip:"专业",
		        dataIndex:"name",
		        align:'center',
                sortable:true,
                style:'font-weight:bold;',
                renderer:function(value)
                {
                    return "<font color=#EE9572>"+value+"</font>";
                }
	        },{
		        header:"课程编号",
		        width:80,
		        tooltip:"课程编号",
		        style:'font-weight:bold;',
		        align:'center',
		        dataIndex:"enabled",
                sortable:true,
                renderer:function(value) {
                    return value == '1' ? '启用' : '禁用';
                }
	        }
	    ]);
        //把config参数CALL给父类，覆盖父类的属性或函数
        peanut.RoleManager.superclass.constructor.call(this,config);
        
    }
});
